//
//  ViewController.m
//  LGIJKPlayerDemo
//
//  Created by wuxiaoyuan on 2019/5/13.
//  Copyright © 2019年 lange. All rights reserved.
//

#import "ViewController.h"
#import "XYPlayerView.h"
#import "Masonry.h"
#define ScreenBounds1            ([UIScreen mainScreen].bounds)
#define ScreenWidth1             ScreenBounds1.size.width
#define ScreenHeight1            ScreenBounds1.size.height
@interface ViewController ()<XYPlayerViewDelegate>

@property (nonatomic, strong) XYPlayerView *playerView1;
@property (nonatomic, copy) NSString *url;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    //    __weak typeof(self) weakSelf = self;
    //url = @"http://192.168.129.8:10155/lgftp/LBD_TeachProgram/tclmy5/57d80f5a-102d-485a-b30c-f0dece144c2c/PreClassProgram/eae6f7b6-caab-4bfe-8b4d-815e9a71aed4/阿甘正传1.mp4";
    self.url = @"http://192.168.129.8:10155/lgftp/LBD_TeachProgram/uitest/5034c0d7-29d9-4a26-b9ff-e1e8399bf1cc/PreClassProgram/d2cd307d-8cad-469f-9738-4087556106b0/穿靴子的猫之萌猫三剑客.mp4";
    [self creatPlayerUI];
}

- (void)creatPlayerUI{
    self.playerView1.frame = CGRectMake(0, 0, ScreenWidth1, 300);
    [self.view addSubview:self.playerView1];
    self.playerView1.url = self.url;
    self.playerView1.resName = @"ijk测试视频";
}


#pragma mark -XYPlayerViewDelegate
- (void)XYPlayerViewDelegateWithIsFull:(BOOL)isFull{
//    if (isFull) {
//        NSLog(@"横屏尺寸");
//        self.playerView.frame = CGRectMake(0, 0, ScreenWidth, ScreenHeight);
//    }else{
//        NSLog(@"竖屏尺寸");
//        self.playerView.frame = CGRectMake(0, 40, ScreenWidth, 300);
//    }
}

#pragma mark -lazy
- (XYPlayerView *)playerView1{
    if (!_playerView1) {
        _playerView1 = [[XYPlayerView alloc]initWithFrame:CGRectZero];
        _playerView1.backgroundColor = [UIColor blackColor];
        _playerView1.ownController = self;
        _playerView1.delegate = self;
        _playerView1.topSpace = 0;
        _playerView1.playerHeight = 300;
    }
    return _playerView1;
}



@end
